﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="../MasterPage.Master"
    CodeBehind="wfAFPMnt.aspx.cs" Inherits="RH.wfAFPMnt" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Import Namespace="Texfina.Common.Mg" %>
<%@ Import Namespace="Texfina.Core.Common" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="../Styles/jquery-ui.custom.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        window.onload = function () {
            var menuTable = document.getElementById('<%=mnuToolbar.ClientID %>');
            var menuLinks = menuTable.getElementsByTagName("a");
            if (menuLinks != null) {
                switch (menuLinks.length) {
                    case 2:
                        menuLinks[0].onclick = function () { return validateEditForm('_BTTSAVE') }
                        break;

                    case 3:
                        menuLinks[0].onclick = function () { return validateEditForm('_BTTSAVE') }
                        menuLinks[1].onclick = function () { return validateEditForm('_BTTSAVNEW') }
                        break;
                }
            }

            
            this.ResizeGrid();
            this.MessageOnPostback();
        }

        function validateGridCommands(key, rowIndex) {
            var row = getGridRowByIndex('<%= grdList.ClientID %>', rowIndex);
            if (getObjInnerText(row.cells[parseInt('<%=_GRDLIST_STANULADO %>')]) == '<%=ConstFlagEstado.ACTIVADO %>') {
                alert('El Resgistro se encuentra eliminado, no puede realizar ninguna accion.');
                return false;
            }

            return true;
        }

        function ResizeGrid() {
            internalGridResize("<%= grdList.ClientID %>");
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="ToolBar">
        <asp:Menu ID="mnuToolbar" runat="server" Orientation="Horizontal" CssClass="ToolBarControl"
            OnMenuItemClick="mnuToolbar_MenuItemClick">
            <Items>
                <asp:MenuItem Text="Guardar" Value="_BTTSAVE" ImageUrl="../Images/Icons/Enabled/SAVE.png">
                </asp:MenuItem>
                <asp:MenuItem Text="Salir" Value="_BTTEXIT" ImageUrl="../Images/Icons/Enabled/BACK.png">
                </asp:MenuItem>
            </Items>
        </asp:Menu>
    </div>
    <div class="DataHeader">
        <table id="TableDataHeader" cellpadding="0" cellspacing="0">
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 10px">
                    &nbsp;
                </td>
                <td>
                    AFP
                </td>
                <td style="width: 10px">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 10px">
                    &nbsp;
                </td>
                <td>
                    <div style="border: 1px solid #ccc; border-radius: 5px; -moz-border-radius: 5px;
                        -webkit-border-radius: 5px; -ms-border-radius: 5px;">
                        <table width="100%" cellpadding="0" cellspacing="2">
                            <tr>
                                <td colspan="13">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 10px;">
                                    &nbsp;
                                </td>
                                <td style="width: 110px;">
                                    Cod. AFP
                                </td>
                                <td colspan="10">
                                    <esd:esdMaskedTextBox runat="server" ID="txtidAfp" Width="100px" Mask="999">
                                    </esd:esdMaskedTextBox>
                                </td>
                                <td style="width: 10px;">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 10px;">
                                    &nbsp;
                                </td>
                                <td>
                                    Razon Social
                                </td>
                                <td colspan="10">
                                    <esd:esdTextBox runat="server" ID="txtdsAfp" Width="180px"></esd:esdTextBox>
                                </td>
                                <td style="width: 10px;">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 10px;">
                                    &nbsp;
                                </td>
                                <td>
                                    Abreviatura
                                </td>
                                <td colspan="10">
                                    <esd:esdTextBox ID="txtdsAbrev" runat="server" Width="180px">
                                    </esd:esdTextBox>
                                </td>
                                <td style="width: 10px;">
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td colspan="13">
                                    &nbsp;
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
                <td style="width: 10px">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
        </table>
    </div>
    <div class="DataDetail">
        <table width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td style="width: 10px;">
                </td>
                <td>
                    <div class="ToolBarGrid">
                        <asp:Menu ID="mnuGrid" runat="server" Orientation="Horizontal" CssClass="ToolBarControl"
                            OnMenuItemClick="mnuGrid_MenuItemClick">
                            <Items>
                                <asp:MenuItem Text="Nuevo" Value="_BTTNEW" ImageUrl="../Images/Icons/Enabled/New.png">
                                </asp:MenuItem>
                            </Items>
                        </asp:Menu>
                    </div>
                    <esd:esdGridView CssClass="esdGridView" ID="grdList" runat="server" ScrollWidth="100%"
                        Width="100%" ShowHeaderWhenEmpty="True" AutoGenerateColumns="False" DataKeyNames="idAfp, idPeriodo, idMes, idTipoComi"
                        OnRowCommand="grdList_RowCommand" OnRowDataBound="grdList_RowDataBound">
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="grdBttCmdEdit" CommandName="CmdEdit" CommandArgument="<%# Container.DataItemIndex %>"
                                        runat="server" ImageUrl="../Images/Icons/Enabled/Edit.png" ToolTip="Editar Comisión" />
                                </ItemTemplate>
                                <HeaderStyle Width="22px" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="grdBttCmdDel" CommandName="CmdDel" CommandArgument="<%# Container.DataItemIndex %>"
                                        runat="server" ImageUrl="../Images/Icons/Enabled/Delete.png" ToolTip="Eliminar Comisión" />
                                </ItemTemplate>
                                <HeaderStyle Width="22px" />
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:BoundField DataField="idMes" HeaderStyle-CssClass="hideDataGridColumn" ItemStyle-CssClass="hideDataGridColumn"></asp:BoundField>
                            <asp:BoundField DataField="dsMes" HeaderText="Mes"></asp:BoundField>
                            <asp:BoundField DataField="idTipoComi" HeaderStyle-CssClass="hideDataGridColumn" ItemStyle-CssClass="hideDataGridColumn"></asp:BoundField>
                            <asp:BoundField DataField="dsTipoComi" HeaderText="Tipo Comisión"></asp:BoundField>
                            <asp:BoundField DataField="idTipoValor" HeaderStyle-CssClass="hideDataGridColumn" ItemStyle-CssClass="hideDataGridColumn"></asp:BoundField>
                            <asp:BoundField DataField="dsTipoValor" HeaderText="Tipo Valor"></asp:BoundField>
                            <asp:BoundField DataField="nuValor" HeaderText="Valor Tasa">
                                <ItemStyle HorizontalAlign="Right" />
                            </asp:BoundField>
                            <asp:BoundField DataField="stAnulado" HeaderStyle-CssClass="hideDataGridColumn" ItemStyle-CssClass="hideDataGridColumn">
                            </asp:BoundField>
                        </Columns>
                        <EmptyDataTemplate>
                            <div id="gridempty">
                                <asp:Image ID="imgEmpty" runat="server" ImageUrl="../Images/Controls/Attention.png" />
                                &nbsp;No existen registros para esta solicitud.
                            </div>
                        </EmptyDataTemplate>
                    </esd:esdGridView>
                </td>
                <td style="width: 10px;">
                </td>
            </tr>
        </table>
    </div>
    <asp:HiddenField ID="hdnMsgOPB" runat="server" />
    <asp:HiddenField ID="hdnidAfp" runat="server" />
    <asp:Panel runat="server" ID="PnlPopup" CssClass="modalPopup" Style="display: none;"
        Width="850px">
        <table width="100%" cellpadding="0" cellspacing="2">
            <tr>
                <td colspan="3">
                    <div class="modalPopupHeader">
                        &nbsp;&nbsp;&nbsp;<asp:Label ID="lblTitlePopup" runat="server"></asp:Label>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 5px;">
                    &nbsp;
                </td>
                <td>
                    <table width="100%" cellpadding="0" cellspacing="2">
                        <tr>
                            <td colspan="13">
                                <div style="border: 1px solid #ccc; border-radius: 5px; -moz-border-radius: 5px;
                                    -webkit-border-radius: 5px; -ms-border-radius: 5px;">
                                    <table width="100%" cellpadding="0" cellspacing="2">
                                        <tr>
                                            <td colspan="3">
                                                &nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td style="width: 10px;">
                                                &nbsp;
                                            </td>
                                            <td style="width: 109px;">
                                                Mes
                                            </td>
                                            <td colspan="2">
                                                <asp:DropDownList ID="ddlidMes" runat="server" Width="150px">
                                                </asp:DropDownList>
                                            </td>
                                        
                                            <td style="width: 10px;">
                                                &nbsp;
                                            </td>
                                            <td style="width: 109px;">
                                                Comisión
                                            </td>
                                            <td colspan="2">
                                                <asp:DropDownList ID="ddlidTipComision" runat="server" Width="150px">
                                                </asp:DropDownList>
                                            </td>
                                            <td style="width: 5px;">
                                                &nbsp;
                                            </td>
                                 
                                            <td style="width: 10px;">
                                                &nbsp;
                                            </td>
                                            <td style="width: 109px;">
                                                Factor de Cálculo
                                            </td>
                                            <td colspan="2">
                                                <asp:DropDownList ID="ddlidTipValor" runat="server" Width="150px">
                                                </asp:DropDownList>
                                            </td>
                                            <td style="width: 5px;">
                                                &nbsp;
                                            </td>
                                            <td style="width: 109px;">
                                                Valor
                                            </td>
                                            <td colspan="10">
                                                <esd:esdNumericTextBox ID="txtmtValor" runat="server" NumericType="Decimal" Width="100px">
                                                </esd:esdNumericTextBox>
                                            </td>
                                            <td style="width: 5px;">
                                                &nbsp;
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3">
                                                &nbsp;
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3">
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 5px;">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td style="width: 5px;">
                    &nbsp;
                </td>
                <td align="right">
                    <esd:esdButton ID="bttOkPopup" runat="server" Text="Aceptar" Width="80px" OnClick="bttOkPopup_Click">
                    </esd:esdButton>
                    <esd:esdButton ID="bttCancelPopup" runat="server" Text="Cancelar" Width="80px"></esd:esdButton>
                </td>
                <td style="width: 5px;">
                    &nbsp;
                </td>
            </tr>
            <tr>
                <td colspan="3">
                    &nbsp;
                </td>
            </tr>
        </table>
    </asp:Panel>
   <ajax:ModalPopupExtender runat="server" ID="mdlPopup" PopupControlID="PnlPopup" BackgroundCssClass="modalBackground"
        TargetControlID="hdnidAfp">
    </ajax:ModalPopupExtender>
</asp:Content>
